package com.whg.demo.biz;

import com.whg.demo.model.User;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @Author whg
 * @create 2022/12/15 14:51
 * @description：
 */
@Component
public class StaticUserOne {

    private static volatile User oneUser = null;

    public StaticUserOne(){

    }

    public User getUser(){
        if(oneUser == null){
            synchronized (User.class){
                if(null == oneUser){
                    oneUser = new User("whg","15797897837",new Date(),24,"88888");
                }
            }
        }
        return oneUser;
    }
}
